using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Linq;
using System.Drawing;

namespace PharmacyPharnet
{
    public static class Extensions
    {
        public static Image GetImageFromFile(this string iconPath, bool isSmallImage)
        {
            string strPathImage = String.Format("{0}\\{1}", Application.StartupPath, iconPath);
            Image img = null;
            if (System.IO.File.Exists(strPathImage))
            {
                if (isSmallImage)
                    img = Image.FromFile(strPathImage).GetThumbnailImage(24, 24, new Image.GetThumbnailImageAbort(delegate
                    {
                        return false;
                    }), IntPtr.Zero);
                else
                    img = Image.FromFile(strPathImage);
            }
            return img;
        }
    }
}
